home *** CD-ROM | disk | FTP | other *** search
/ Disc to the Future 2 / Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin / MAC / THINKC / 4_0 / VIVIDUS / VECT.SIT / vect / vect.h < prev   
C/C++ Source or Header  |  1991-09-25  |  3KB  |  89 lines

  1. #pragma    once
  2.  
  3. /*    ======================================================================
  4.  
  5.     This header file is Copyright 1991 by Vividus Consulting.
  6.     
  7.     This is not public domain source code.  You may not copy and
  8.     paste from this source code.  Read your Vividus Licensing
  9.     agreement for details and other restrictions.
  10.     
  11.     This header file is for anything that uses the vect Vividus
  12.     Source Code Library.
  13.  
  14.     ======================================================================    */
  15.  
  16. #ifndef    PI
  17. #define    PI    3.141592653589793238
  18. #endif    PI
  19.  
  20. #define    _vect_
  21.  
  22. typedef    double    velem;
  23. typedef struct {
  24.     velem    x,y,z;
  25. } vector;                                    /* a whole vector */
  26.  
  27. typedef struct CoordSys{
  28.     vector    xAxis, yAxis, zAxis;
  29. } CoordSys;
  30.  
  31. typedef struct {
  32.     int        x, y, z;
  33. }    IntVector;
  34.  
  35. typedef    struct    {
  36.     Fixed    x, y, z;
  37. }    FixedVector;
  38.  
  39. void    vunit(vector *v, vector *vo);
  40. void    vcopy(vector *v, vector *vo);
  41.  
  42. void    vscale(velem scalar, vector *v, vector *vo);
  43. void    vsub(vector *a, vector *b, vector *v); 
  44. void    vvect(vector *a, vector *b, vector *v); 
  45. void    vadd(vector *a, vector *b, vector *v); 
  46. void    vsadd(vector *b, velem m, vector *x, vector *v);
  47.  
  48. void    vcross(vector *a, vector *b, vector *v); 
  49. velem    vdot(vector *a, vector *b); 
  50. velem    vmag(vector *v);
  51. velem    vdist(vector *a, vector *b);
  52. velem    vangle(vector *a, vector *b); 
  53.  
  54. void    vmul(vector *a, vector *b, vector *v); 
  55. void    vsphere2v(double rho, double phi, double theta, vector *v); 
  56. void    vv2sphere(vector *v, double *rho, double *phi, double *theta);
  57.  
  58. void    vnorm(vector x[], vector *norm); 
  59. void    vmatmul(vector *a, vector m[], vector *v);
  60.  
  61. void    vcmin(vector *a, vector *b, vector *out); 
  62. void    vcmax(vector *a, vector *b, vector *out);
  63. Boolean vvalid(vector *v);
  64.  
  65.  
  66. void    vCopy(int n, vector x[], vector xn[]);
  67. void    vTranslate(int n, vector x[], vector *b, vector xn[]);
  68. void    vScale(int n, vector x[], vector *s, vector xn[]);
  69. void    vRotate(int n, vector x[], vector *o, vector *norm, velem angle, vector xn[]);
  70. void    vRotate3(int n, vector x[], vector *a, vector *b, vector *c, vector xn[]);
  71.  
  72.  
  73. void    v2fv(vector *v, FixedVector *fv);
  74. void    fv2v(FixedVector *fv, vector *v); 
  75. void    fv2iv(FixedVector *fv, IntVector *iv); 
  76. void    iv2fv(IntVector *iv, FixedVector *fv); 
  77.  
  78. void    fvcopy(FixedVector *v, FixedVector *vo); 
  79. void    fvscale(Fixed scalar, FixedVector *v, FixedVector *vo); 
  80. void    fvvect(FixedVector *a, FixedVector *b, FixedVector *v); 
  81. void    fvsub(FixedVector *a, FixedVector *b, FixedVector *v); 
  82. void    fvadd(FixedVector *a, FixedVector *b, FixedVector *v); 
  83.  
  84. void    ivcopy(IntVector *v, IntVector *vo);
  85. void    ivscale(int scalar, IntVector *v, IntVector *vo); 
  86. void    ivvect(IntVector *a, IntVector *b, IntVector *v); 
  87. void    ivsub(IntVector *a, IntVector *b, IntVector *v); 
  88. void    ivadd(IntVector *a, IntVector *b, IntVector *v);
  89.